# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-ukkonen
pkgver=1.0.1
pkgrel=2
pkgdesc="Implementation of bounded Levenshtein distance (Ukkonen)"
url="https://github.com/asottile/ukkonen"
license=('MIT')
arch=('loong64' 'x86_64')
depends=('python-cffi')
makedepends=('python-setuptools')
checkdepends=('python-pytest')
source=("https://github.com/asottile/ukkonen/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('23978b8e22454155e7d8a0d2dbb963f4aa5a6be6cdd75a74e8ec5e06fe32a96b6fc14f0f6d03089726bf761ad6d833dc68ea3fb6cad1ad2ee5b259043072875a')

build() {
  cd ukkonen-$pkgver
  python setup.py build
}

check() {
  cd ukkonen-$pkgver
  PYTHONPATH=build/lib.linux-$CARCH-cpython-311 python -m pytest
}

package() {
  cd ukkonen-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
